package com.atguigu.syt.cmn.controller.inner;

import com.atguigu.syt.cmn.service.DictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "数据字典")
@RestController
@RequestMapping("/inner/cmn/dict")
public class InnerDictController {
    @Resource
    private DictService dictService;

    @ApiOperation(value = "获取数据字典名称")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dictTypeId",value = "字典类型id", required = true),
            @ApiImplicitParam(name = "value",value = "字典值", required = true)})
    @GetMapping(value = "/getName/{dictTypeId}/{value}")
    public String getName(
            @PathVariable("dictTypeId") Long dictTypeId,
            @PathVariable("value") String value) {
        return dictService.getNameByDictTypeIdAndValue(dictTypeId, value);
    }
}
